package com.game.model.goods;


import com.game.model.api.GoodsType;
import com.game.model.api.Quality;

import java.io.Serializable;
import java.util.Objects;

/**
 * @Description:物品
 **/
public abstract class Goods implements Serializable {
    private int id;
    private GoodsType type;//类型 ，1自身加成（丹药，经验..） 2.背包物品
    private String name;//名称
    private Quality quality;//品质
    private int useLevel;//使用等级限制
    private String description;//描述

    public Goods() {
    }

    public Goods(int id, GoodsType type, String name, Quality quality, int useLevel, String description) {
        this.id = id;
        this.type = type;
        this.name = name;
        this.quality = quality;
        this.useLevel = useLevel;
        this.description = description;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public GoodsType getType() {
        return type;
    }

    public void setType(GoodsType type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Quality getQuality() {
        return quality;
    }

    public void setQuality(Quality quality) {
        this.quality = quality;
    }

    public int getUseLevel() {
        return useLevel;
    }

    public void setUseLevel(int useLevel) {
        this.useLevel = useLevel;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Goods goods = (Goods) o;
        return id == goods.id &&type == goods.type &&
                Objects.equals(name, goods.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, type, name);
    }

    @Override
    public String toString() {
        return "Goods{" +
                "id=" + id +
                ", type=" + type +
                ", name='" + name + '\'' +
                ", quality=" + quality +
                ", useLevel=" + useLevel +
                ", description='" + description + '\'' +
                '}';
    }
}
